"""
  单例模式：
导入包时会执行 __init__.py

"""
import time


class SingleTon:
    __instance = None

    def __new__(cls):
        if cls.__instance is None:
            return

        return cls.__instance


t = time.time()
print(t)
# Return the current time in seconds since the Epoch.

print('123')
time.sleep(2)
print('321')

s = time.ctime(t)
print(s)

t1 = time.localtime(t)
print(t1)
print(t1.tm_yday)
print(t1.tm_mon)

print('* tt' * 30)
tt = time.mktime(t1)
print(tt)

# time.struct_time(tm_year=2020, tm_mon=8,
# tm_mday=20, tm_hour=19, tm_min=9, tm_sec=20,
# tm_wday=3, tm_yday=233, tm_isdst=0)

t3 = time.time()

# result = time.strftime('%Y - %m - %d', t3)
# print(result)

t = (2009, 2, 17, 17, 3, 38, 1, 48, 0)
t = time.mktime(t)
print(time.strftime("%b %d %Y %H:%M:%S", time.gmtime(t)))

"""
   strftime(format[, tuple]) -> string

   Convert a time tuple to a string according to a format specification.
   See the library reference manual for formatting codes. When the time tuple
   is not present, current time as returned by localtime() is used.

   Commonly used format codes:

   %Y  Year with century as a decimal number.
   %m  Month as a decimal number [01,12].
   %d  Day of the month as a decimal number [01,31].
   %H  Hour (24-hour clock) as a decimal number [00,23].
   %M  Minute as a decimal number [00,59].
   %S  Second as a decimal number [00,61].
   %z  Time zone offset from UTC.
   %a  Locale's abbreviated weekday name.
   %A  Locale's full weekday name.
   %b  Locale's abbreviated month name.
   %B  Locale's full month name.
   %c  Locale's appropriate date and time representation.
   %I  Hour (12-hour clock) as a decimal number [01,12].
   %p  Locale's equivalent of either AM or PM.

   Other codes may be available on your platform.  See documentation for
   the C library strftime function.
   """

"""
python中时间日期格式化符号：

%y 两位数的年份表示（00-99）
%Y 四位数的年份表示（000-9999）
%m 月份（01-12）
%d 月内中的一天（0-31）
%H 24小时制小时数（0-23）
%I 12小时制小时数（01-12）
%M 分钟数（00=59）
%S 秒（00-59）
%a 本地简化星期名称
%A 本地完整星期名称
%b 本地简化的月份名称
%B 本地完整的月份名称
%c 本地相应的日期表示和时间表示
%j 年内的一天（001-366）
%p 本地A.M.或P.M.的等价符
%U 一年中的星期数（00-53）星期天为星期的开始
%w 星期（0-6），星期天为星期的开始
%W 一年中的星期数（00-53）星期一为星期的开始
%x 本地相应的日期表示
%X 本地相应的时间表示
%Z 当前时区的名称
%% %号本身

"""


